<?php
    defined('_JEXEC') or die(); 
    JHTML::_('behavior.tooltip'); 
    $listOrder    = @$this->lists['order'];
    $listDirn    = @$this->lists['order_Dir'];
    $user = &JFactory::getUser();
?>
<style>
    #tbl_filter{
        margin: 0 ; padding: 0 ;
    }
    #tbl_filter td{
        padding: 3px;
    }
    #tbl_filter input, #tbl_filter img {
        float: left;
        margin: 0 5px 0 0;
        width: auto;
    }
</style>
<link rel="stylesheet" type="text/css" href="<?php echo JURI::root(); ?>js/multiselect/jquery.multiselect.css" />
<link rel="stylesheet" type="text/css" href="<?php echo JURI::root(); ?>js/multiselect/jquery-ui.css" />
<script type="text/javascript" src="<?php echo JURI::root(); ?>js/jquery.js"></script>
<script type="text/javascript" src="<?php echo JURI::root(); ?>js/jquery-ui.min.js"></script>
<script type="text/javascript" src="<?php echo JURI::root(); ?>js/multiselect/jquery.multiselect.js"></script>

<script type="text/javascript">
    function submitform(pressbutton){
        var form = document.adminForm ;
        
        if (pressbutton)
        {
            form.task.value=pressbutton ;
        }
        if ((pressbutton=='send_redemp_notice_email')||(pressbutton=='send_redemp_pick_up_notice')){
              form.controller.value="reports" ;
        }
        form.submit();
    }
    
    jQuery(function(){
        jQuery("#pick_up_at").multiselect({
            selectedList: 0,
            noneSelectedText: 'Select outlet',
            selectedText: "# of # selected"
        }); 
    });
</script>
<div class="col width-100">    
    
        <div id="editcell">
            <form action="<?php echo JRoute::_("index.php?option=com_wrd")?>" method="post" name="filterform" >
                <table style='margin-bottom:5px' id="tbl_filter">
                    <tbody>
                        <tr>
                            <td align="left" valign="bottom" style="border-right: 1px solid #d0d0d0;">
                                <table >
                                    <tr valign="top">
                                        <td valign="top" width='110px'>Business Date  From</td>        
                                        <td valign="top" width='150px'>
                                           <?php
												echo JHTML::_ ( 'calendar', $this->pr['date_from'], 'date_from', 'date_from', '%Y-%m-%d');
											?>
                                        </td>
                                       
                                    </tr>
                                    <tr>
                                        <td width='110px'>Business Date To</td>        
                                        <td width='150px'>
                                            <?php
												echo JHTML::_ ( 'calendar', $this->pr['date_to'], 'date_to', 'date_to', '%Y-%m-%d');
											?>
                                        </td>
                                      
                                    </tr>
                                </table>
                            </td>
                            <td align="left" valign="bottom" style="border-right: 1px solid #d0d0d0;">
                                <table >
                                    <tr>
                                        <td>
                                             Outlet: 
                                        </td>
                                        <td style="width: 236px;">
                                            <?php echo $this->lists['filter_pick_up_outlet'] ; ?>                                            
                                        </td>
                                    </tr>
                                    <tr>
                                        
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td style="text-align: left ;">
                                            <input type="submit" name="view" onclick="document.getElementById('task').value = ''" value="View" />
                                        </td>
                                    </tr>
                                </table>
                            </td>
                            <td align="left" valign="bottom">
                                <table >
                                    <tr>
                                        <td>
                                             Top: 
                                        </td>
                                        <td>
                                            Choose: 
                                            <select name="topDisplaySelect" id="topDisplaySelect">
                                                <option value="10">10</option>
                                                <option value="20">20</option>
                                                <option value="50">50</option>
                                                <option value="100">100</option>
                                                <option value="0">All</option>
                                            </select>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td style="text-align: left ;padding: 10px 0 0;">                                            
                                            <input type="submit" id="exportexcel" name="exportexcel" onclick="document.getElementById('task').value = 'extransactionreportweb'" value="Export excel" />
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <input type="hidden" name="controller" value="reports" />
                <input type="hidden" name="option" value="com_wrd" />
                <input type="hidden" name="submitViewExcel" id="submitViewExcel" value="" />
                <input type="hidden" name="layout" id="layout" value="transactionreportweb" />
				<input type="hidden" name="task" id="task" value="" />
            </form>    
            <br /><br />
            <form id="adminForm" action="<?php echo JRoute::_("index.php?option=com_wrd")?>" method="post" name="adminForm" >
                <table class="adminlist">
                    <thead>
                        <tr><td align="right" colspan="17"><strong style="color:#c61907;font-size: 16px;">Total: <?php echo $this->pagination->total; ?></strong></td></tr>
						<tr>
							<th width="3%">
                                Order
                            </th>	
							<th nowrap="nowrap" width="12%">  
                                 Name
                             </th>
							<th width="3%">
                               Business Date
                            </th>
                            <th nowrap="nowrap" width="6%">
                               Begin Time
                            </th>  
							<th nowrap="nowrap" width="6%">
                               End Time
                            </th>  							
							<th nowrap="nowrap" width="5%">  
                               Outlet Name
                            </th> 
                            <th nowrap="nowrap" width="5%">  
                               Member ID
                            </th> 
							<th nowrap="nowrap" width="15%">  
							   Transaction
							</th>
                            <th nowrap="nowrap" width="8%">  
                                 Cover
                            </th>                                                       
                            <th nowrap="nowrap" width="8%">  
                                Food
                            </th>   
                            <th nowrap="nowrap" width="8%">  
                                Beverage
                            </th>                                                                              
                             <th nowrap="nowrap" width="8%">  
                                 Other
                             </th>                             
                             <th nowrap="nowrap" width="5%">  
                                 Discount
                             </th>   
                             <th nowrap="nowrap" width="5%">  
                                  Netsale
                             </th>   
                             <th nowrap="nowrap" width="5%">  
                                  Service Charge
                             </th>
							 <th nowrap="nowrap" width="5%">  
                                  Tax
                             </th>
							 <th nowrap="nowrap" width="5%">  
                                  Actual Paid
                             </th>
							 
                        </tr>
                    </thead>
                    <tbody>
                         <?php
							
							for($i = 0; $i < count($this->items['items']); $i++){
							?>    
                                 <tr class="<?php echo "row".($i%2); ?>" >
                                    <td>
                                        <?php echo $i+1; ?>
                                    </td>
									<td>
									<a target="_blank" href="index.php?option=com_wrd&controller=profile&id=<?php echo $this->items['items'][$i]->profile_id ?>&layout=form">
                                            <?php echo $this->items['items'][$i]->l_name.' '.$this->items['items'][$i]->f_name; ?>
                                     </a>
									</td>
                                     <td>  
									   <?php echo date("d/m/Y",strtotime($this->items['items'][$i]->date_receipt)); ?>
                                    </td>
									
                                    <td>
                                        <?php echo date("H:i:s",strtotime($this->items['items'][$i]->date_receipt)); ?>
                                    </td>
									<td>
                                        <?php echo strtotime($this->items['items'][$i]->endtime) ? date("H:i:s",strtotime($this->items['items'][$i]->endtime)) : ''; ?>
                                    </td>
                                    
                                    <td>
                                        <?php echo $this->items['items'][$i]->outletName; ?>
                                    </td>                                
                                    <td>
                                        <?php echo $this->items['items'][$i]->vip_number; ?>
                                    </td>
                                    <td>
                                       <?php echo $this->items['items'][$i]->transaction_id; ?>
                                    </td>
                                    
                                    <!-- 3 -->
                                    <td>
                                        <?php echo $this->items['items'][$i]->pax; ?>
                                    </td>
                                    <td>
                                        <?php echo $this->items['items'][$i]->food; ?>
                                    </td>
                                    <td>
                                       <?php echo $this->items['items'][$i]->beverage; ?>
                                    </td>                                
                                    <td>
                                        <?php echo $this->items['items'][$i]->other; ?>
                                    </td>
									<td>
                                        <?php echo $this->items['items'][$i]->discount; ?>
                                    </td>
									<td>
                                        <?php echo number_format($this->items['items'][$i]->netsale,0,".",","); ?>
                                    </td>
									
									<td>
                                        <?php echo $this->items['items'][$i]->sc; ?>
                                    </td>
									<td>
                                        <?php echo $this->items['items'][$i]->vat; ?>
                                    </td>
									<td>
                                        <?php echo number_format($this->items['items'][$i]->total,0,".",","); ?>
                                    </td>
                                    
                                 </tr>
                             <?php } ?>
                         </tbody>
                     <tfoot>
                        <tr>
                            <td colspan="16">
                                <?php
                                     echo $this->pagination->getListFooter();
                                ?>
                            </td>
                        </tr>
                    </tfoot>
                </table>
                <input type="hidden" name="controller" value="reports" />
                <input type="hidden" name="option" value="com_wrd" />
                <input type="hidden" name="task" value="exportpendinguser" />
                <input type="hidden" name="boxchecked" value="0" />
                <?php echo JHTML::_( 'form.token' ); ?>
            </form>
        </div>
</div>